home *** CD-ROM | disk | FTP | other *** search
/ Mac Format 1996 April / MacFormat CD Edition MF36 (April 1996).iso / Shareware City / Developers / Tools Plus - GUI⁄Event libs / Tools Plus 2.6.1a Evaluat'n Kit / Tools Plus 2.6.1a / User Manual / 08-Scroll Bars < prev    next >
INI File  |  1994-12-12  |  17KB  |  271 lines

  1. [Display using Monaco 9]
  2.  
  3.  
  4. 8  Scroll Bars
  5. ``````````````
  6.  
  7.   Tools Plus supports the use of scroll bars on any Tools Plus window.  Scroll bars are created on the current window by the NewScrollBar procedure.  Each scroll bar is referenced by a unique scroll bar number, that can be from 1 to 255.  This number is specified when the scroll bar is created, and refers to the specific scroll bar until that scroll bar is deleted.  Note that the scroll bar number is related to its associated window.  This means that two different windows can each have a scroll bar numbered “1” without interfering with each other.  Whenever a scroll bar is used by the user, the PollSystem function reports the scroll bar number, the part (see below) that was used, and its window number.
  8.  
  9.   Scroll bars can be either horizontal or vertical, and are made up of five distinct parts:
  10.    [1] up arrow (arrow pointing up on vertical scroll bars, or left on
  11.        horizontal scroll bars)
  12.    [2] down arrow (arrow pointing down on vertical scroll bars, or right
  13.        on horizontal scroll bars)
  14.    [3] thumb (movable tab situated between the up arrow and down arrow)
  15.    [4] “page up” region (the region between the up arrow and the thumb)
  16.    [5] “page down” region  (the region between the down arrow and the
  17.        thumb)
  18.  
  19.   A scroll bar’s minimum and maximum limits can be obtained by the GetScrollBarMin and GetScrollBarMax functions.  The current value can be obtained by the GetScrollBarVal function.  Conversely, these values can be set by using the SetScrollBarMin, SetScrollBarMax, and SetScrollBarVal procedures.
  20.  
  21.   When a scroll bar is no longer required, it is deleted by the DeleteScrollBar procedure, which releases the memory used by the scroll bar.  This is done automatically if a window is closed.
  22.  
  23.  
  24.  
  25.  
  26.  
  27. Scroll Bar States
  28. `````````````````
  29.   A scroll bar is enabled or disabled by the EnableScrollBar procedure.  When a window is inactive, all the associated scroll bars are automatically hidden (only the outline is displayed) and cannot be selected.  When the window is activated, the scroll bars return to their normal status as set by your application.
  30.  
  31.  
  32.  
  33.  
  34.  
  35. Handling Scroll Bars
  36. ````````````````````
  37.   Your application specifies if a scroll bar is enabled or disabled.  When a window in inactive, Tools Plus disables all scroll bars on that window.  When the window is activated again, all the scroll bars regain their correct status as specified by your application.  If a window contains a scroll bar along its right side and/or bottom (such as on word processing documents and spreadsheets), these scroll bars are automatically sized and moved if the user drags the window’s “size box” (providing that the window has a “size box”) or clicks the “zoom box.”.
  38.  
  39.   The PollSystem function is used to constantly inquire about any events that have occurred, including scroll bar interaction.  If any part of a scroll bar is selected, it is reported by PollSystem.  When the user moves the scroll bar’s thumb, GetScrollBarVal should be called to obtain the scroll bar’s new value.  Simply moving the thumb, then leaving it in the same position does not generate an event.  If the user clicks and holds the up arrow, “page up” region, down arrow, or “page down” region, PollSystem reports an event for this part of the scroll bar each time PollSystem is called.
  40.  
  41. Warning: If you have obtained a handle to a scroll bar, do not change
  42.          any of the fields in the scroll bar’s record.
  43.  
  44. ------------------------------------------------------------------------
  45.  
  46. NewScrollBar
  47. ````````````
  48. Create a new scroll bar.
  49.  
  50.    pascal void NewScrollBar (short ScrollBar, short left, short top,
  51.                  short right, short bottom, Boolean EnabledFlag,
  52.                  short minimum, short value, short maximum);
  53.  
  54.    procedure NewScrollBar(ScrollBar, left, top, right, bottom: INTEGER;
  55.                  EnabledFlag: BOOLEAN;
  56.                  minimum, value, maximum: INTEGER);
  57.  
  58.   ScrollBar specifies the scroll bar number (from 1 to 255) that is created in the current window.  Once a scroll bar is created, it is referenced by this scroll bar number.  If a scroll bar has been previously created in the current window using the same number, it is replaced with a new scroll bar as specified by the parameters in the NewScrollBar procedure.  If the current window doesn’t belong to your application, or if no windows are open, NewScrollBar does nothing.
  59.  
  60.   Left, top, right, and bottom define a rectangle in local co-ordinates that determines the scroll bar’s size and location in the window.  These parameters can be seen as two corners; the upper left-hand corner (left,top) and the bottom right-hand corner (right,bottom).  A scroll bar is vertical or horizontal depending on whether the height or width of the rectangle is greatest.  Scroll bars should be exactly 16 pixels wide, so there should be a 16 pixel difference between the scroll bar’s top and bottom, or left and right side.  If there isn’t, the scroll bar is scaled to fit into the rectangle and will not look as attractive.  Also, the scroll bar must be at least 40 pixels long in order to contain the up arrow, down arrow, and thumb.
  61.  
  62.   For windows with a ProcID of documentProc (i.e. with a “size box”) two special scroll bars may be created; one along the right side of a window and/or one along the bottom.  These scroll bars are special because they are automatically sized and moved if the window’s size is changed.  Here are some useful measurements for these specialized scroll bars:
  63.  
  64. Right scroll bar  (left,top)  To place the top of the scroll bar exactly
  65.                               below the window’s title bar, give left
  66.                               the value of the window’s width - 15, and
  67.                               top the value of -1.  (The window’s
  68.                               dimensions can be obtained from the
  69.                               WindowStatus procedure.)
  70.  
  71.               (right,bottom)  To place the bottom of the scroll bar
  72.                               exactly at the upper edge of the “size
  73.                               box”, give right the value of the window’s
  74.                               width + 1, and bottom the value of the
  75.                               window’s height - 14.  If these exact
  76.                               dimensions are not used, the scroll bar
  77.                               will not be sized or moved when the
  78.                               window’s size is changed.
  79.  
  80.                               If you use the following constants, Tools
  81.                               Plus will place the scroll bar along the
  82.                               right edge of the window:
  83.                                 left    scrlRightEdge
  84.                                 top     scrlTopEdge   (optional)
  85.                                 right   scrlRightEdge
  86.                                 bottom  scrlBottomEdge
  87.  
  88. Bottom scroll bar (left,top)  To place the left side of the scroll bar
  89.                               exactly at the window’s left edge, give
  90.                               left the value of - 1, and top the value
  91.                               of the window’s height -15.
  92.  
  93.               (right,bottom)  To place the right side of the scroll bar
  94.                               exactly at the left edge of the “size
  95.                               box,” give right the value of the window’s
  96.                               width - 14, and bottom the value of the
  97.                               window’s height + 1.  If these exact
  98.                               dimensions are not used, the scroll bar
  99.                               will not be sized or moved when the
  100.                               window’s size is changed.
  101.  
  102.                               If you use the following constants, Tools
  103.                               Plus will place the scroll bar along the
  104.                               bottom edge of the window:
  105.                                 left    scrlLeftEdge   (optional)
  106.                                 top     scrlBottomEdge
  107.                                 right   scrlRightEdge
  108.                                 bottom  scrlBottomEdge
  109.  
  110.   EnabledFlag specifies if the scroll bar is enabled or disabled when the window is active.  When a scroll bar is disabled, the thumb and toned “page up” and “page down” regions disappear, and the scroll bar cannot be used by the operator.  The two constants that can be used for this purpose are enabled and disabled .  All scroll bars automatically become hidden (only the outline is shown) when the window containing them becomes inactive.  When the window is activated, the scroll bars will assume their normal state as set by the NewScrollBar procedure, and subsequent calls to the EnableScrollBar procedure.
  111.  
  112. Minimum declares the scroll bar’s minimum value limit.
  113.  
  114.   Value defines the scroll bar’s current value.  The current value must be greater than or equal to the minimum value, and less than or equal to the maximum value.
  115.  
  116.   Maximum declares the scroll bar’s maximum value limit.  The maximum value limit must be greater than the minimum value limit.
  117.  
  118. Also see:  NewScrollBarRect.
  119.  
  120. Note: Tools Plus makes no attempt to control the placement of scroll
  121.       bars or to protect them once they have been created.  It is the
  122.       programmer’s responsibility to ensure that scroll bars are of
  123.       sufficient length to contain the up/down arrows and the thumb, and
  124.       that their placement within the window is reasonable and does not
  125.       conflict with other objects.  Furthermore, you should not allow
  126.       your application’s text and drawing processes to interfere with
  127.       scroll bars.  Windows with a “size box” should not allow scroll
  128.       bars to be obscured or hidden by making the window too small.
  129.  
  130.   CONST                   {Scroll bar state                       }
  131.     enabled       =true;  {enable the scroll bar                  }
  132.     disabled      =false; {disable the scroll bar                 }
  133.     scrlLeftEdge  =-1;    {SCROLL BARS: left edge of document     }
  134.     scrlTopEdge   =-1;    {             top edge of document      }
  135.     scrlRightEdge =32767; {             right edge of document    }
  136.     scrlBottomEdge=32767; {             bottom edge of document   }
  137.  
  138. ------------------------------------------------------------------------
  139.  
  140. NewScrollBarRect
  141. ````````````````
  142. Create a new scroll bar.
  143.  
  144.    pascal void NewScrollBarRect (short ScrollBar, Rect *Bounds,
  145.                  Boolean EnabledFlag,
  146.                  short minimum, short value, short maximum);
  147.  
  148.    procedure NewScrollBarRect(ScrollBar: INTEGER; Bounds: RECT;
  149.                  EnabledFlag: BOOLEAN;
  150.                  minimum, value, maximum: INTEGER);
  151.  
  152.   NewScrollBarRect is identical to the NewScrollBar procedure, except that it accepts the Bounds rectangle in place of the individual left, top, right and bottom co-ordinates.
  153.  
  154. ------------------------------------------------------------------------
  155.  
  156. DeleteScrollBar
  157. ```````````````
  158. Delete a scroll bar.
  159.  
  160.    pascal void DeleteScrollBar (short ScrollBar);
  161.  
  162.    procedure DeleteScrollBar(ScrollBar: INTEGER);
  163.  
  164.   ScrollBar specifies the scroll bar number (from 1 to 255) that is deleted from the current window.  If the current window doesn’t belong to your application, or if no windows are open, or if the scroll bar does not exist in the current window, DeleteScrollBar does nothing.
  165.  
  166. ------------------------------------------------------------------------
  167.  
  168. EnableScrollBar
  169. ```````````````
  170. Enable or disable a scroll bar.
  171.  
  172.    pascal void EnableScrollBar (short ScrollBar, Boolean EnabledFlag);
  173.  
  174.    procedure EnableScrollBar(ScrollBar: INTEGER; EnabledFlag: BOOLEAN);
  175.  
  176.   ScrollBar specifies the scroll bar number (from 1 to 255) that is to be affected in the current window.  If the current window doesn’t belong to your application, or if no windows are open, or if the scroll bar does not exist in the current window, EnableScrollBar does nothing.
  177.  
  178.   EnabledFlag specifies if the scroll bar is enabled or disabled when the window is active.  When a scroll bar is disabled, the thumb and toned “page up” and “page down” regions disappear and the scroll bar cannot be selected by the user.  The two constants that can be used for this purpose are enabled and disabled .
  179.  
  180.   All scroll bars automatically become disabled if the window containing them becomes inactive.  When the window is activated, the scroll bars assume their normal state as set by the EnableScrollBar procedure.
  181.  
  182.   CONST                   {Scroll bar state                       }
  183.     enabled  =true;       {enable the scroll bar                  }
  184.     disabled =false;      {disable the scroll bar                 }
  185.  
  186. ------------------------------------------------------------------------
  187.  
  188. GetScrollBarMin
  189. ```````````````
  190. Get a scroll bar’s minimum value limit.
  191.  
  192.    pascal short GetScrollBarMin (short ScrollBar);
  193.  
  194.    function GetScrollBarMin(ScrollBar: INTEGER): INTEGER;
  195.  
  196.   ScrollBar specifies the scroll bar number (from 1 to 255) that is queried in the current window.
  197.  
  198.   GetScrollBarMin returns a scroll bar’s minimum value limit.  If the current window doesn’t belong to your application, or if no windows are open, or if the scroll bar does not exist in the current window, GetScrollBarMin will return a value of zero (0).
  199.  
  200. ------------------------------------------------------------------------
  201.  
  202. SetScrollBarMin
  203. ```````````````
  204. Set a scroll bar’s minimum value limit.
  205.  
  206.    pascal void SetScrollBarMin (short ScrollBar, short minimum);
  207.  
  208.    procedure SetScrollBarMin(ScrollBar, minimum: INTEGER);
  209.  
  210.   ScrollBar specifies the scroll bar number (from 1 to 255) that is affected in the current window.  If the current window doesn’t belong to your application, or if no windows are open, or if the scroll bar does not exist in the current window, SetScrollBarMin does nothing.
  211.  
  212.   Minimum specifies the scroll bar’s new minimum value limit.  The scroll bar’s current value and maximum limit are automatically adjusted (if necessary) to be consistent with the new minimum limit.
  213.  
  214. ------------------------------------------------------------------------
  215.  
  216. GetScrollBarMax
  217. ```````````````
  218. Get a scroll bar’s maximum value limit.
  219.  
  220.    pascal short GetScrollBarMax (short ScrollBar);
  221.  
  222.    function GetScrollBarMax(ScrollBar: INTEGER): INTEGER;
  223.  
  224.   ScrollBar specifies the scroll bar number (from 1 to 255) that is queried in the current window.
  225.  
  226.   GetScrollBarMax returns a scroll bar’s maximum value limit.  If the current window doesn’t belong to your application, or if no windows are open, or if the scroll bar does not exist in the current window, GetScrollBarMax will return a value of zero (0).
  227.  
  228. ------------------------------------------------------------------------
  229.  
  230. SetScrollBarMax
  231. ```````````````
  232. Set a scroll bar’s maximum value limit.
  233.  
  234.    pascal void SetScrollBarMax (short ScrollBar, short maximum);
  235.  
  236.    procedure SetScrollBarMax(ScrollBar, maximum: INTEGER);
  237.  
  238.   ScrollBar specifies the scroll bar number (from 1 to 255) that is affected in the current window.  If the current window doesn’t belong to your application, or if no windows are open, or if the scroll bar does not exist in the current window, SetScrollBarMax does nothing.
  239.  
  240.   Maximum specifies the scroll bar’s new maximum value limit.  The scroll bar’s current value and minimum limit are automatically adjusted (if necessary) to be consistent with the new maximum limit.
  241.  
  242. ------------------------------------------------------------------------
  243.  
  244. GetScrollBarVal
  245. ```````````````
  246. Get a scroll bar’s current value.
  247.  
  248.    pascal short GetScrollBarVal (short ScrollBar);
  249.  
  250.    function GetScrollBarVal(ScrollBar: INTEGER): INTEGER;
  251.  
  252.   ScrollBar specifies the scroll bar number (from 1 to 255) that is queried in the current window.
  253.  
  254.   GetScrollBarVal returns a scroll bar’s current value.  If the current window doesn’t belong to your application, or if no windows are open, or if the scroll bar does not exist in the current window, GetScrollBarVal will return a value of zero (0).
  255.  
  256. ------------------------------------------------------------------------
  257.  
  258. SetScrollBarVal
  259. ```````````````
  260. Set a scroll bar’s current value.
  261.  
  262.    pascal void SetScrollBarVal (short ScrollBar, short value);
  263.  
  264.    procedure SetScrollBarVal(ScrollBar, Value: INTEGER);
  265.  
  266.   ScrollBar specifies the scroll bar number (from 1 to 255) which is to be affected in the current window.  If the current window doesn’t belong to your application, or if no windows are open, or if the scroll bar does not exist in the current window, SetScrollBarVal does nothing.
  267.  
  268.   Value specifies the scroll bar’s new current value.  The scroll bar’s minimum and maximum limits are automatically adjusted (if necessary) to be consistent with the new current value.
  269.  
  270. ------------------------------------------------------------------------
  271.